<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<jsp:include page="../include/header.jsp" />
<script type="text/javascript" src="<c:url value='/htmlRes/js/datepicker/jquery.ui.core.js'/>"></script>
<script type="text/javascript" src="<c:url value='/htmlRes/js/datepicker/jquery.ui.datepicker.js'/>"></script>
<script type="text/javaScript">
<!--
	function viewPage(id) {
		$('#sto_task_key').val(id);
		$('#listForm').attr('action', '<c:url value="/task/taskView.do"/>');
		$('#listForm').submit();		
	}

	function writeFormPage() {
		$('#listForm').attr('action', '<c:url value="/task/taskWriteForm.do"/>');
		$('#listForm').submit();
	}

	/* pagination 페이지 링크 function */
	function paging(pageNo){
		$('#pageIndex').val(pageNo);
		$('#listForm').attr('action', '<c:url value="/task/taskList.do"/>');
		$('#listForm').submit();
	}
	
	function searchForm(){
		$('#pageIndex').val('1');
		$('#listForm').attr('action', '<c:url value="/task/taskList.do"/>');
		$('#listForm').submit();
	}

	$(document).ready(function(){
		$( "#searchSdate" ).datepicker();
		$( "#searchEdate" ).datepicker();
	});
-->
</script>
<!-- contents s -->
<div class="container" id="container">
	<span class="round lt">&nbsp;</span>
	<span class="round rt">&nbsp;</span>
	<span class="round lb">&nbsp;</span>
	<span class="round rb">&nbsp;</span>
	<div class="container_area">
	<form name="listForm" id="listForm" method="post" action="<c:url value='/task/taskList.do'/>">
		<input type="hidden" name="pageIndex" id="pageIndex" value="${taskVO.pageIndex }"/>
		<input type="hidden" name="sto_task_key" id="sto_task_key" />
	
		<h2 class="tit_h2">업무연락 목록</h2>
		<jsp:include page="../include/navi.jsp" />
		<div class="srch_wrap">
			<fieldset>
				<legend>키워드 검색 조회 영역</legend>
				<label for="searchStatus">상태</label>
				<c:if test="${loginSessionInfo.admin }">
				<select id=searchStatus name="searchStatus" title="상태 검색" onchange="searchForm();">
					<option value="">전체</option>
					<option value="Y" <c:if test="${taskVO.searchStatus eq 'Y'}">selected="selected"</c:if>>사용</option>
					<option value="N" <c:if test="${taskVO.searchStatus eq 'N'}">selected="selected"</c:if>>삭제</option>
				</select>
				</c:if>
				<label for="searchSdate">등록일 </label><input type="text" id="searchSdate" name="searchSdate" value="${taskVO.searchSdate }"/> - <input type="text" id="searchEdate" name="searchEdate" value="${taskVO.searchEdate }">&nbsp;&nbsp;
                         <label for="searchKeyword">제목</label>
				<input type="text" title="검색영역" id="searchKeyword" name="searchKeyword" class="input_srch" value="${taskVO.searchKeyword }"/>
				<a href="<c:url value='/task/taskList.do'/>" onclick="searchForm();return false;" class="btn_srch">검색</a>
			</fieldset>
		</div>
		<div class="table_wrap">
			<table summary="업무일지 목록 입니다" class="table_list">
				<caption>업무일지 목록</caption>
				<c:if test="${loginSessionInfo.admin }">
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="10%" />
						<col width="50%" />
						<col width="10%" />
						<col width="30%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">번호</th>
							<th scope="col">제목</th>
							<th scope="col">작성자</th>
							<th scope="col">등록일</th>
						</tr>
					</thead>
					<tbody>
					<c:if test="${not empty resultList}">
						<c:forEach var="result" items="${resultList}" varStatus="status">
						<tr>
							<td>${(taskVO.rowNum)-(status.count-1)}</td>
							<td class="tit"><a href="<c:url value="/task/taskView.do"/>?sto_task_key=${result.sto_task_key}" onclick="viewPage('${result.sto_task_key}');return false;"><c:if test="${result.sto_flag_yn eq 'N'}"><span style="color:red">[삭제]</span></c:if> ${result.sto_task_title } <span class="pointReB">[${result.total_area_cnt }/${result.read_area_cnt }]</span></a></td>
							<td>관리자</td>
							<td>${result.sto_regi_date }</td>
						</tr>
						</c:forEach>
					</c:if>
					<c:if test="${empty resultList}">
					<tr>
						<td colspan="4">데이터가 없습니다.</td>
					</tr>
					</c:if>
				</c:if>
				<c:if test="${!loginSessionInfo.admin }">
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="10%" />
						<col width="45%" />
						<col width="15%" />
						<col width="15%" />
						<col width="15%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">번호</th>
							<th scope="col">제목</th>
							<th scope="col">작성자</th>
							<th scope="col">등록일</th>
							<th scope="col">수신일</th>
						</tr>
					</thead>
					<tbody>
					<c:if test="${not empty resultList}">
						<c:forEach var="result" items="${resultList}" varStatus="status">
						<tr <c:if test="${empty result.STS_READ_TIME }"></c:if>><!-- <tr <c:if test="${empty result.STS_READ_TIME }">class="pointBold"</c:if>> -->
							<td>${(taskVO.rowNum)-(status.count-1)}</td>
							<td class="tit">
								<a href="<c:url value="/task/taskView.do"/>?sto_task_key=${result.STO_TASK_KEY}" 
									onclick="viewPage('${result.STO_TASK_KEY}');return false;">
									${result.STO_TASK_TITLE }
									<c:if test="${not empty result.STO_MODI_DATE and empty result.STS_READ_TIME }">[수정됨 : ${result.STO_MODI_DATE}]</c:if>
								</a>
							</td>
							<td>관리자</td>
							<td>${result.STO_REGI_DATE }</td>
							<td>${result.STS_READ_TIME }</td>
						</tr>
						</c:forEach>
					</c:if>
					<c:if test="${empty resultList}">
						<tr>
							<td colspan="5">데이터가 없습니다.</td>
						</tr>
					</c:if>
					</tbody>
				</c:if>
				</tbody>
			</table>
		</div><!--//table_wrap-->
		<div class="paging">
			<ui:pagination paginationInfo="${taskVO}" type="image" jsFunction="paging" />
		</div>
		<c:if test="${loginSessionInfo.admin }">
		<div class="btn_bbs">
			<a href="<c:url value="/task/taskWriteForm.do"/>" onclick="writeFormPage(); return false;" class="btn_write">글쓰기</a>
		</div>
		</c:if>
		</form>
	</div><!--//container_area-->
</div>
	<!-- contents e -->
<jsp:include page="../include/footer.jsp" />